# -*- encoding:utf-8 -*-
from demo import app
import flask


def route(rule, **kwargs):
    """
        自定义admin路由

    """
    def decorator(fun):
        if fun.__name__.find('admin') == -1:
            fun.__name__ = 'admin.' + fun.__name__
        app.add_url_rule('/admin' + rule, None, fun, **kwargs)
        return fun
    return decorator


def render_template(path, **kwargs):
    """
        自定义admin render方法

    """
    return flask.render_template('/admin' + path, **kwargs)
